<template>
  <div class="app-container">
    <TisTable
      :columns="column"
      :tools="tools"
      :url="'plantmgtservice/EquipmentQuery/GetEquipmentByPage'"
    >

      <el-button
        slot="add"
        class="filter-item"
        type="primary"
        icon="el-icon-plus"
        @click="handleCreate"
      >新增
      </el-button>
      <el-button
        slot="edit"
        class="filter-item"
        type="success"
        icon="el-icon-plus"
        @click="handleCreate"
      >
        编辑
      </el-button>
      <el-button
        slot="delete"
        class="filter-item"
        type="danger"
        icon="el-icon-plus"
        @click="handleCreate"
      >删除
      </el-button>
    </TisTable>
    <!-- <TisTable
      :columns="column"
      :url="'plantmgtservice/EquipmentQuery/GetEquipmentByPage'"
    /> -->
    <TisDialog
      ref="dialog1"
      :columns="dialogColumn"
      :option="dOption"
      @submit="submit"
    />

  </div>
</template>

<script>

export default {
  name: 'Equipment',
  data() {
    return {
      column: [
        {
          field: 'id',
          label: 'id',
          width: '50'
        },
        {
          field: 'name',
          label: '名称'
        },
        {
          field: 'mono',
          label: '备注'
        },
        {
          field: 'equipmentLevelId',
          label: 'EquipmentLevelId'
        },
        {
          field: 'frozenFlag',
          label: 'FrozenFlag'
        }

      ],
      tools: [
        {
          slot: 'add'
        }
      ],
      dialogColumn: [
        {
          label: '名称',
          field: 'name',
          value: 'test',
          pre: '请输入测试的值'

        },
        {
          label: 'Switch',
          field: 'ceshi',
          value: true,
          pre: '请输入测试的值',
          type: 'switch'
        },
        {
          label: '复选框',
          field: 'mono',
          value: ['吃饭'],
          type: 'checkBoxGroup',
          options: ['吃饭', '睡觉', '打豆豆']
        },
        {
          label: '下拉',
          field: 'select',
          value: '选项1',
          type: 'select',
          options: [{
            value: '选项1',
            label: '黄金糕'
          }, {
            value: '选项2',
            label: '双皮奶'
          }],
          pre: '请输入测试的值'
        }
      ],
      dOption: {
        title: '测试',
        visible: false
      }
    }
  },

  methods: {
    submit(data) {
      // const formData = this.$refs.dialog1.getFormData()
      this.$refs.dialog1.setFormData({ name: 'hh', mono: ['吃饭', '睡觉', '打豆豆'] })
    },
    handleCreate() {
      this.dOption.visible = true
    }
  }
}
</script>
